
<h1><?php echo $title; ?></h1>
<div class="noprint">
<script type="text/javascript">
$(document).ready(function(){
	$("#tutto").click(function(){
		$('input.checkmese').prop('checked', this.checked);
 	});
});
</script>

<?php if (isset($notice) || $notice = $this->session->flashdata('notification')):?>
<p class="notice"><?php echo $notice;?></p>
<?php endif;?>

<?php if (count($rows) == 0) : ?>
<p class="notice"><?php echo __("Nessuno risultato", $module);?></p>
<?php endif; ?>

<form method='post' action="<?php echo site_url('adozioni/contabilita/offerte/annuali') ?>" >
<div class="filter">
<label for="filter[anno]"><?php echo __("Anno", $module) ?></label>
<select name="filter[anno]">
<?php foreach($anni as $a): ?>
<option value="<?php echo $a['anno'] ?>" <?php if($a['anno'] == $filter['anno']) echo " selected "; ?>><?php echo $a['anno']; ?></option>
<?php endforeach; ?>
</select>

<label for="filter[id_missione]"><?php echo __("Missione", $module) ?></label>
<select name="filter[id_missione]">
<?php foreach($missioni as $m): ?>
<option value="<?php echo $m['id'] ?>" <?php if($m['id'] == $filter['id_missione']) echo " selected "; ?>><?php echo $m['nome']; ?></option>
<?php endforeach; ?>
</select>

<label for="filter[sostenitore]"><?php echo __("Sostenitore", $module) ?></label>
<input type="text" name="filter[sostenitore]" id="filter[sostenitore]" value="<?php if(isset($filter['sostenitore'])) echo $filter['sostenitore'] ?>" />
<label for="filter[assistito]"><?php echo __("Assistito", $module) ?></label>
<input type="text" name="filter[assistito]" id="filter[assistito]" value="<?php if(isset($filter['assistito'])) echo $filter['assistito'] ?>" />
<br />

<label for="tutto"><input type="checkbox" id="tutto" checked /><b>Seleziona Tutti Mesi</b></label> | 
<?php for($i = 1; $i <= 12; $i++): ?>
<input type="checkbox" class='checkmese' name="filter[mese][<?php echo $i ;?>]" id="filter[mese][<?php echo $i ;?>]" <?php if(isset($filter['mese'][$i])): ?>checked<?php endif; ?> value=1 /><label for="filter[mese][<?php echo $i ;?>]"><?php echo $nome_mese[$i] ?></label>
<?php endfor; ?>
|
<label for="excel"><input type="checkbox" name="excel" value="1" /><b>Excel</b></label> 
|
<input type="submit" name="submit" value="   <?php echo __('Ok', $module) ?>   " />

</div>
</form>
</div>
<table class="list" cellpadding=3 >
	<thead>
		<tr>
				<th width="3%" class="center">#</th>
				<th><?php echo anchor('adozioni/contabilita/offerte/annuali/order_by/id_adozione', __("Scheda", $module), array('id' => 'id_adozione'))?></th>
				<th><?php echo anchor('adozioni/contabilita/offerte/annuali/order_by/s.nomecognome',__("Sostenitore", $module), array('id' => 's.nomecognome'))?></th>
				<th><?php echo anchor('adozioni/contabilita/offerte/annuali/order_by/a.nomecognome',__("Assistito", $module), array('id' => 'a.nomecognome'))?></th>
				<?php for($i = 1; $i <= 12; $i++): ?>
                <?php if(isset($filter['mese'][$i])): ?>
				<th><?php echo $nome_mese[ $i ] ?></th>
                <?php endif; ?>
				<?php endfor; ?>
				<th ><?php echo __("Totale", $module)?></th>
		</tr>
	</thead>
	<tbody>
<?php if (count($rows) > 0) : ?>
<?php $i = 1; foreach ($rows as $row): ?>
<?php if ($i % 2 != 0): $rowClass = 'odd'; else: $rowClass = 'even'; endif;?>
		<tr class="<?php echo $rowClass?>">
				<td class="center"><?php echo $i?></td>
				<td><?php echo $row['id_adozione'] ?></td>
				<td><?php echo $row['sostenitore'] ?></td>
				<td><?php echo $row['assistito'] ?></td>
				<?php for($j = 1; $j <= 12; $j++): ?>
                <?php if(isset($filter['mese'][$j])): ?>
				<td align="right" <?php echo (isset($row[ 'mese'.$j ])?'': 'style="color: #AAAAAA"')?> ><?php echo format_euro(isset($row[ 'mese'.$j ])?$row[ 'mese' .$j]: '0') ?></td>
				<?php endif; ?>
				<?php endfor; ?>
				<td align="right" class="total"><?php echo format_euro($row['totale_anno']) ?></td>
		</tr>
<?php $i++; endforeach; ?>
		<tr class="total">
				<td colspan=4><?php echo __("Totale", $module) ?></td>
				<?php for($j = 1; $j <= 12; $j++): ?>
                <?php if(isset($filter['mese'][$j])): ?>
				<td align="right"><?php echo format_euro($totale_mensile[ $j ]) ?></td>
                <?php endif; ?>
				<?php endfor; ?>
				<td align="right"><?php echo format_euro($totale_generale) ?></td>
		</tr>
<?php endif; ?>
</tbody>
</table>	